$(document).ready(
    function(){	
	$(function(){
            $('#shortname').focus();
	});
	$('#parse_info').submit(
		function(){
			var shortname = $.trim($('#shortname').val());
			var description = $.trim($('#description').val());
			var sid = $('#sid').val();
			var startline = $('#startline').val();
			var endline = $('#endline').val();
			if(shortname == ""){
				$("#info").html('<div class="error">需要输入数据说明！</div>');
				$('#shortname').focus();
				return false;
			}else if(description == ""){
				$("#info").html('<div class="error">需要详细描述！</div>');
				$('#description').focus();
				return false;
			}else{
				//$('.loadingAnim img').show();
				$("#info").html("");
				
				//alert(sid+","+startline+","+endline+","+shortname+","+description);
				
				$.ajax({
					type:'POST',
					url:$("#site_url").val()+'/parse/parse_file',
					dataType:'html',
					data:{shortname:shortname,description:description,sid:sid,startline:startline,endline:endline},
					contentType: "application/x-www-form-urlencoded; charset=utf-8",
					success:function(data){
						//$('.loadingAnim img').hide();
						$('#info').html(data);
					},
					error:function(XMLHttpRequest,textStatus,errorThrown){
						alert("error");
					}
				});
				return false;
				
			}
		});	
    });

	function setSection( start,  end)
	{
	    //alert(start+","+end);
	    $("#startline").val(start);
	    $("#endline").val(end);
	}